package com.jzhao.control;

import com.jzhao.jpre.util.CodeConverter;

public class TexttoBinary {

	private static final int maxBytes = 1;

	public static int convert(char number) {

	   // BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
	    System.out.print("Type the number to parse: ");
	    //int number = Integer.parseInt(in.readLine());
	    int Bit;
	    //char number = '1';
	    //UInt8 i;
	    String result = "";
	    for (int i = maxBytes * 7; i >=0; i--) {
	        Bit = 1 << i;
	        if (number >= Bit) {
	            result += 1;
	            //System.out.println(result);
	            number -= Bit;
	        } else {
	            result += 0;
	        }
	    }
	    System.out.println(result);
	   return Integer.parseInt(result);
	}
	public static void main(String args[]){
	    String msg ="TP12";
//	    char[] toCharArray = msg.toCharArray();
//	    char lrc=0;
//	    for(int i=0;i<toCharArray.length;i++){
//	    lrc ^= convert(toCharArray[i]);
//	    }
//	    System.out.println((byte)lrc);
	    
	    String hexStr = "38";
	    byte[] bb = CodeConverter.hexStringToByte(hexStr);
	    
	    char[] toCharArray = new String( bb).toCharArray();
	    char lrc=0;
	    for(int i=0;i<toCharArray.length;i++){
	    	char aa = (char)bb[i];
	    	System.out.println("aa:"+aa);
	    	lrc ^= convert(aa);
	    }
	    System.out.println((byte)lrc);
	  
	    System.out.println(Integer.parseInt("fffff",16));
	    
	    int getedSessionId = 256;
		//String ss  = CodeConverter.int2bytes(arg0)
		;
		
		;
		
		System.out.println(Integer.toHexString(16));
	   
	}

}
